<script language='JavaScript' type='text/javascript'>
function clears()
{
    document.getElementById('subdirectory').innerHTML='';
    document.getElementById('filenames').innerHTML='';
}
</script>

<div id="maincontent">

	<%= render :partial => "shared_common_files/data_area_help_bar" %>

		<h2>Theme Editor</h2>

		<!-- %= start_form_tag( {:action => ''}, {:class => 'appform'}) %-->
		<%= form_remote_tag(:update => "subdirectory",
                       						:url => {:action => :'get_subdirectories'},
						                    :position => "top",
						                    :html => {:class => 'appform',:name=>'theme'}
						                 	)%>

			<fieldset>

						<%= javascript_include_tag "prototype" %>

						<h3>Modify Theme</h3>
		
						

	


	
					<%
						str=""
						str1=""
						dir_path=Dir.getwd;
						dir=dir_path+"/themes";
						dir_name=Dir.new(dir);

						  dir_name.each {|x|
					      if(!x.index(".")) 
					          str="<option>"+x+"</option>";
					          str1.concat(str);     
					      end    
 										}
					%>

<label for="name"><b>Select theme to edit :</b>

<%= select_tag "list" ,str1%>
</label>
</select>
						<div class="f-submit-wrap">
							<!-- input type="submit" name="savebutton" value="Select" onclick = "javascript: clears();"/ --> 	
							<input type="image" src="/themes/odotclassic/images/btn_select.png" onclick = "javascript: clears();"/><br />	
						</div>
								
								
								</fieldset>
											<%= end_form_tag %>




					<div>
						<%= start_form_tag ({:action => 'update_file'},{:class => 'appform', :name =>'theme1'}) %>
							<table style="border: 1px dotted #ccc; width:100%;">
								<tr>
									<td width="10%">
										<%= text_area_tag "body", nil , :size => "82x20"%>
									</td>
		
									<td style="border: 1px dotted #ccc;" valign="top">
										<table>
											<tr>
												<td width="40%">
													<h4> Theme Folders </h4>
														<div id="subdirectory">
														</div>
												</td>
											</tr>
											
											<tr>
		    									<table style="border: 1px dotted #ccc; background-color: #Fcc;">
		    										<tr>
														<td width="10%">
															<h4>Files</h4> 					
																<div id="filenames">
																</div>	
														</td>
													</tr>
												</table>
											</tr> 
											
										</table> 
									</td>
							</table>
					
				
			    <fieldset>
				<div class="f-submit-wrap">
               						 <!-- %=submit_tag "Update File" % -->
               						 <!-- %= link_if_authorized submit_tag('Reset'), {:action => 'themeeditor'}  % -->
              						 <!-- input type="button" value="Cancel" onclick="javascript:history.go(-1);"/ -->
            					
            					<%= image_submit_tag "/themes/odotclassic/images/btn_update.gif", :alt => 'Update', :border => 0 %>
            					<%= link_if_authorized image_tag('/themes/odotclassic/images/btn_reset.png', :alt => 'Reset'),  :action => 'themeeditor'%>
            					<a href="javascript:history.go(-1);"><img src="/themes/odotclassic/images/btn_cancel.gif"/></a>
				</div>
																	<!-- %=submit_tag "Update File" % -->
				</fieldset>
<%= end_form_tag %> 
	</div>						
</div>